/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.thienloc.omap.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author GiangLT
 */
@Entity
@Table(name = "TINH_THANH", catalog = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TinhThanh.findAll", query = "SELECT t FROM TinhThanh t ORDER BY t.maTinh"),
    @NamedQuery(name = "TinhThanh.findById", query = "SELECT t FROM TinhThanh t WHERE t.id = :id ORDER BY t.maTinh"),
    @NamedQuery(name = "TinhThanh.findByMaTinh", query = "SELECT t FROM TinhThanh t WHERE t.maTinh = :maTinh ORDER BY t.maTinh"),
    @NamedQuery(name = "TinhThanh.findByTenTinh", query = "SELECT t FROM TinhThanh t WHERE t.tenTinh = :tenTinh ORDER BY t.maTinh"),
    @NamedQuery(name = "TinhThanh.findMaTinhByListVung", query = "SELECT t.maTinh FROM TinhThanh t WHERE t.vungMien in :listVungMien ORDER BY t.maTinh"),
    @NamedQuery(name = "TinhThanh.findAllMaTinh", query = "SELECT DISTINCT(t.maTinh) FROM TinhThanh t"),
    @NamedQuery(name = "TinhThanh.findByVungMien", query = "SELECT t FROM TinhThanh t WHERE t.vungMien = :vungMien ORDER BY t.maTinh")})
public class TinhThanh implements Serializable {
    @OneToMany(mappedBy = "provinceId")
    private List<LotterySchedule> lotteryScheduleList;

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Size(max = 20)
    @Column(name = "MA_TINH")
    private String maTinh;
    @Size(max = 100)
    @Column(name = "TEN_TINH")
    private String tenTinh;
    @Size(max = 40)
    @Column(name = "VUNG_MIEN")
    private String vungMien;
    @Column(name = "REGION_CODE")
    private Integer regionCode;

    public TinhThanh() {
    }

    public TinhThanh(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getMaTinh() {
        return maTinh;
    }

    public void setMaTinh(String maTinh) {
        this.maTinh = maTinh;
    }

    public String getTenTinh() {
        return tenTinh;
    }

    public void setTenTinh(String tenTinh) {
        this.tenTinh = tenTinh;
    }

    public String getVungMien() {
        return vungMien;
    }

    public void setVungMien(String vungMien) {
        this.vungMien = vungMien;
    }

    public Integer getRegionCode() {
        return regionCode;
    }

    public void setRegionCode(Integer regionCode) {
        this.regionCode = regionCode;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TinhThanh)) {
            return false;
        }
        TinhThanh other = (TinhThanh) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.thienloc.omap.entity.TinhThanh[ id=" + id + " ]";
    }

    @XmlTransient
    public List<LotterySchedule> getLotteryScheduleList() {
        return lotteryScheduleList;
    }

    public void setLotteryScheduleList(List<LotterySchedule> lotteryScheduleList) {
        this.lotteryScheduleList = lotteryScheduleList;
    }
}
